different ways to make api requests in javascript